# Maintainer: David Runge <dvzrv@archlinux.org>

_name=ansible-vim
pkgname=vim-ansible
pkgver=3.2
pkgrel=2
pkgdesc="A vim plugin for syntax highlighting Ansible's common filetypes"
arch=(any)
url="https://github.com/pearofducks/ansible-vim"
license=(
  BSD
  MIT
)
groups=(vim-plugins)
depends=(
  python-jinja
  vim
)
makedepends=(
  ansible
  python
)
optdepends=('vim-ultisnips: for ansible snippets')
source=($url/archive/$pkgver/$_name-$pkgver.tar.gz)
sha512sums=('a75e8b149befb001fdb0012ea8219287a6b4c302e2ae2de456835c48e3a516bb99bfb91a21e2d60eff12b5a24d918510dd9302d93e0bf43cb42f025ea0504d1b')
b2sums=('e532b348216f3616060b9e09d177d601534c37eda1305512309954e0480e2827bd6f2d40564151104184a389c495b2442264f34d5b8031a1023ddd093cdd1be6')

build() {
  cd $_name-$pkgver
  # generating a reproducible UltiSnips snippet file:
  # https://github.com/pearofducks/ansible-vim/pull/105
  python UltiSnips/generate.py --style=dictionary
}

package() {
  cd $_name-$pkgver
  install -vDm 644 ftdetect/*.vim -t "$pkgdir/usr/share/vim/vimfiles/ftdetect/"
  install -vDm 644 ftplugin/*.vim -t "$pkgdir/usr/share/vim/vimfiles/ftplugin/"
  install -vDm 644 indent/*.vim -t "$pkgdir/usr/share/vim/vimfiles/indent/"
  install -vDm 644 syntax/*.vim -t "$pkgdir/usr/share/vim/vimfiles/syntax/"
  install -vDm 644 ansible.snippets -t "$pkgdir/usr/share/vim/vimfiles/UltiSnips/"
  install -vDm 644 README.md -t "$pkgdir/usr/share/doc/$pkgname/"
  install -vDm 644 syntax/*.vim_LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/"
  install -vDm 644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/"
}
